package br.usp.icmc.biomac.client.view.lixo;

import com.google.gwt.dom.client.Element;
import com.google.gwt.event.dom.client.*;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.user.client.ui.Widget;

/**
 * @author amsnyder
 */
public class DomHandle<T extends Element>
        extends Widget
        implements HasChangeHandlers, HasClickHandlers
{
    private T t;

    public DomHandle(T t) {
        setElement(t);
        onAttach();
        this.t = t;
    }

    public T element() {
        return t;
    }

    @Override
    public HandlerRegistration addChangeHandler(ChangeHandler changeHandler) {
        return addDomHandler(changeHandler, ChangeEvent.getType());
    }

    @Override
    public HandlerRegistration addClickHandler(ClickHandler clickHandler) {
        return addDomHandler(clickHandler, ClickEvent.getType());
    }
}
